package constant.milk.periodapp.dialog;

import constant.milk.periodapp.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class MilkColorLineDialog extends Dialog implements OnClickListener
{
	private ColorLineCallBack callBack;
	
	private View contentView;
	
	private TextView tv1;
	private TextView tv2;
	private TextView tv3;
	private TextView tv4;
	private TextView tv5;
	private TextView tv6;
	private TextView tv7;
	private TextView tv8;
	private TextView tv9;
	private TextView tv10;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.dialog_color_line);
		
		setFindView();
		setOnClick();
		setData();
	}
	
	private void setFindView()
	{
		contentView = findViewById(R.id.dialogColorLineContentView);
		tv1 = (TextView) findViewById(R.id.dialogColorLine1TextView);
		tv2 = (TextView) findViewById(R.id.dialogColorLine2TextView);
		tv3 = (TextView) findViewById(R.id.dialogColorLine3TextView);
		tv4 = (TextView) findViewById(R.id.dialogColorLine4TextView);
		tv5 = (TextView) findViewById(R.id.dialogColorLine5TextView);
		tv6 = (TextView) findViewById(R.id.dialogColorLine6TextView);
		tv7 = (TextView) findViewById(R.id.dialogColorLine7TextView);
		tv8 = (TextView) findViewById(R.id.dialogColorLine8TextView);
		tv9 = (TextView) findViewById(R.id.dialogColorLine9TextView);
		tv10 = (TextView) findViewById(R.id.dialogColorLine10TextView);
	}

	private void setOnClick()
	{
		contentView.setOnClickListener(this);
		tv1.setOnClickListener(this);
		tv2.setOnClickListener(this);
		tv3.setOnClickListener(this);
		tv4.setOnClickListener(this);
		tv5.setOnClickListener(this);
		tv6.setOnClickListener(this);
		tv7.setOnClickListener(this);
		tv8.setOnClickListener(this);
		tv9.setOnClickListener(this);
		tv10.setOnClickListener(this);
	}

	private void setData()
	{
	}

	public MilkColorLineDialog(Context context, ColorLineCallBack callBack)
	{
		super(context, android.R.style.Theme_Translucent_NoTitleBar);
		this.callBack = callBack;
	}
	
	@Override
	public void onClick(View v)
	{
		if (v.getId() == R.id.dialogColorLineContentView)
		{
			dismiss();
			return;
		}
		
		callBack.getColor((String) v.getTag());
		dismiss();
	}

	public interface ColorLineCallBack
	{
		public abstract void getColor(String color);
	}
}
